using System;
using System.Collections.Generic;
using System.Text;
using AAM.BIZ;
using AAM;

namespace CMS.BIZ
{
    [DatabaseTable(TableName = "MessageStates",TableAlias="msgSt")]
    public class BizMessageState : BizObject
    {
        public static readonly ObjectType ObjectType = new ObjectType("BizMessageState");

        public static readonly int MessageVisible = 0;
        public static readonly int MessageNotVisible = 1;


        private int messageID = 0;
        private int memberID = 0;
        private int messageState = 0;
        private int? messageFolder = null;
        private DateTime? messageViewDate = null;
        private DateTime? messageDeleteDate = null;

        private BizMessage message;

        public BizMessageState()
            : base(ObjectType, new object[] { 0, 0 })
        {
        }

        [DatabaseRow(PrimaryKey = true)]
        public int MessageID
        {
            get { return messageID; }
            set { messageID = value; ID[0] = value; }
        }
        [DatabaseRow(PrimaryKey = true,PrimaryKeyIndex=1)]
        public int MemberID
        {
            get { return memberID; }
            set { memberID = value; ID[1] = value; }
        }
        [DatabaseRow()]
        public int MessageState
        {
            get { return messageState; }
            set { messageState = value; }
        }
        [DatabaseRow()]
        public int? MessageFolder
        {
            get { return messageFolder; }
            set { messageFolder = value; }
        }
        [DatabaseRow()]
        public DateTime? MessageViewDate
        {
            get { return messageViewDate; }
            set { messageViewDate = value; }
        }
        [DatabaseRow()]
        public DateTime? MessageDeleteDate
        {
            get { return messageDeleteDate; }
            set { messageDeleteDate = value; }
        }

        public BizMessage Message
        {
            get { return message; }
            set { message = value; }
        }
        public bool IsRead { get { return messageViewDate != null; } }
    }
}
